package com.xiangpq.pattern.creationalPatterns.factoryPattern;

/**
 * @author XPQ
 * @function
 * @since 2024-04-01
 */
public class FactoryPatternDemo {
    public static void main(String[] args) {
        ShapeFactory shapeFactory = new ShapeFactory();

        // 获取Circle得对象，并调用他们得draw方法
        Shape circle = shapeFactory.getShape("CIRCLE");
        // 调用Circle得draw方法
        circle.draw();

        // 获取Rectangle得对象，并调用他的draw方法
        Shape rectangle = shapeFactory.getShape("RECTANGLE");
        // 调用rectangle的draw方法
        rectangle.draw();

        // 获取Square的对象，并调用他的draw方法
        Shape square = shapeFactory.getShape("SQUARE");
        //调用square的draw方法
        square.draw();
    }
}
